Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
pretty-data
Advanced tools
The pretty-data npm package is a utility for formatting and minifying JSON, XML, and CSS data. It helps in making data more readable or compact, depending on the need.
JSON Pretty Print
This feature formats JSON data to be more readable by adding indentation and line breaks.
const pd = require('pretty-data').pd;
const json = '{"name":"John","age":30,"city":"New York"}';
console.log(pd.json(json));
JSON Minify
This feature minifies JSON data by removing unnecessary whitespace, making it more compact.
const pd = require('pretty-data').pd;
const json = '{"name":"John","age":30,"city":"New York"}';
console.log(pd.jsonmin(json));
XML Pretty Print
This feature formats XML data to be more readable by adding indentation and line breaks.
const pd = require('pretty-data').pd;
const xml = '<root><name>John</name><age>30</age><city>New York</city></root>';
console.log(pd.xml(xml));
XML Minify
This feature minifies XML data by removing unnecessary whitespace, making it more compact.
const pd = require('pretty-data').pd;
const xml = '<root><name>John</name><age>30</age><city>New York</city></root>';
console.log(pd.xmlmin(xml));
CSS Pretty Print
This feature formats CSS data to be more readable by adding indentation and line breaks.
const pd = require('pretty-data').pd;
const css = 'body{margin:0;padding:0;}h1{color:red;}';
console.log(pd.css(css));
CSS Minify
This feature minifies CSS data by removing unnecessary whitespace, making it more compact.
const pd = require('pretty-data').pd;
const css = 'body{margin:0;padding:0;}h1{color:red;}';
console.log(pd.cssmin(css));
js-beautify is a popular package for beautifying JavaScript, JSON, CSS, and HTML. It offers more customization options compared to pretty-data and supports a wider range of languages.
Prettier is an opinionated code formatter that supports many languages including JavaScript, JSON, CSS, and HTML. It is widely used in the development community for its ease of integration with various editors and build tools.
xml-formatter is a specialized package for formatting XML data. It provides more advanced options for handling XML namespaces and attributes compared to pretty-data.
jsonminify is a package specifically designed for minifying JSON data. It is lightweight and focuses solely on JSON minification, making it faster for this specific task compared to pretty-data.
nodejs plugin to pretty-print or minify text in XML, JSON, CSS and SQL formats.
Version - 0.40.0
Copyright (c) 2012 Vadim Kiryukhin ( vkiryukhin @ gmail.com )
Home page: http://www.eslinstructor.net/pretty-data/
License: Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
##Description
pd.xml(data )
- pretty print XML;
pd.json(data)
- pretty print JSON;
pd.css(data )
- pretty print CSS;
pd.sql(data )
- pretty print SQL;
pd.xmlmin(data [, preserveComments])
- minify XML;
pd.jsonmin(data)
- minify JSON text;
pd.cssmin(data [, preserveComments] )
- minify CSS text;
pd.sqlmin(data)
- minify JSON text;
PARAMETERS:
@data
- String; XML, JSON, CSS or SQL text to beautify;
@preserveComments
- Bool (optional, used in npp.minxml and npp.mincss only);
Set this flag to true to prevent removing comments from @data;
@Return
- String;
USAGE:
var pd = require('pretty-data').pd;
var xml_pp = pd.xml(data);
var xml_min = pd.xmlmin(data [,true]);
var json_pp = pd.json(data);
var json_min = pd.jsonmin(data);
var css_pp = pd.css(data);
var css_min = pd.cssmin(data [, true]);
var sql_pp = pd.sql(data);
var sql_min = pd.sqlmin(data);
TEST:
`node ./test/test_xml
`node ./test/test_json
`node ./test/test_css
`node ./test/test_sql
FAQs
plugin to pretty-print or minify XML, JSON, CSS and SQL files
The npm package pretty-data receives a total of 277,458 weekly downloads. As such, pretty-data popularity was classified as popular.
We found that pretty-data demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.